<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>管理员-用户信息详情</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <!--标准mui.css-->
    <link rel="stylesheet" href="../css/mui.min.css">

    <!--App自定义的css-->
    <!--<link rel="stylesheet" type="text/css" href="../css/app.css"/>-->
    <style>
        li{ list-style:none; }
        .mui-input-row label{width: 100%;font-size: 15px;}
        .mui-input-group .mui-input-row{
            height: 32px;
        }
        label{
            font-size: 12px!important;
        }
    </style>

</head>
<body>
<div class="mui-content" >            
    <form class="mui-input-group" style="margin-top: 0px;">
        <div class="mui-input-row ">
            <label >用户姓名：<span id="username"></span></label>
        </div>
        <div class="mui-input-row ">
            <label style="">注册时间：<span id="createtime"></span></label>
        </div>
        <div class="mui-input-row ">
            <label style="float: right!important;">联系电话：<span id="mobile" ></span></label>
        </div>
        <div class="mui-input-row ">
            <label style="float: right!important;">身份证：<span id="sfz" ></span></label>
        </div>
        <div class="mui-input-row ">
            <label>地址：<span id="address"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>当前可提现余额：<span id="money"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>当前级别：<span id="level"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>上级经纪人姓名：<span id="upusername"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>上级经纪人联系电话：<span id="upmobile"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>上级经纪人地址：<span id="upaddress"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>上级经纪人可提现：<span id="jjrmoney"></span></label>
        </div>
    </form>

    <div class="mui-input-row "  id="remakevalue">
        <label style="width: 30%">选择：</label>
        <select class="shortselect" id="levename">
            <option value="0" >粉丝</option>
            <option value="1" >客户</option>
            <option value="2" >一级经纪人</option>
            <option value="3" >加盟商</option>
            <option value="4" >后续经纪人</option>
        </select>
    </div>
    <div class="mui-input-row " style="height: 40px;" id="butn">
        <a  href="JavaScript:saveusertype()"class="mui-btn mui-btn-primary" style="height: 35px;margin-top: 5px;color: #FFF;float: right;width: 100%">修改级别</a>
    </div>
    <div class="mui-input-row " style="height: 40px;" >
        <a  href="JavaScript:setadminupdataUpagent()"class="mui-btn mui-btn-primary" style="height: 35px;margin-top: 5px;color: #FFF;float: right;width: 100%">修改经纪人</a>
    </div>
    <div class="footerpage">
    </div>
</div>

</body>

<script src="../js/mui.min.js"></script>
<script src="../js/practise/push.js"></script>
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/getUrlParam.js"></script>
<script src="../js/cookieutil.js" type="text/javascript" charset="utf-8"></script>
<script>
    var userid=getUrlParam("userid");
    var updatauserid;
    function saveusertype() {
        var levename= document.getElementById("levename").value;
        if (levename==""||levename==null||levename==undefined)
        {
            mui.toast('请你选择一个类型！');
            return;
        }
        var dataobj = {
            type: levename,
            userid:updatauserid,
        }
        mui.post('/User/updatusertype',
            dataobj,
            function(data) {
                if (data.object>0)
                {
                    mui.toast('提交成功！');
                    window.location.reload();
                }
            },'json'
        )
    }

    function setadminupdataUpagent()
    {
        window.location.href = "adminupdataUpagent.html?updatauserid=" + updatauserid;
    }

function getuser(){
    mui.post('/User/findByid',
        {
            id:userid
        },
        function(data){
            console.log(data);
            if (data.code&&data.object!=null){
                var  item=data.object;
                updatauserid=item.id;
                var username = document.getElementById("username");
                username.innerHTML =item.username;//改变内容

                var sfz = document.getElementById("sfz");
                sfz.innerHTML =item.bio;//改变内容

                var level = document.getElementById("level");
                level.innerHTML =getusertypedata(item.level);//改变内容

                var time = document.getElementById("createtime");
                time.innerHTML =formattimeuser(item.createtime);//改变内容

                var mobile = document.getElementById("mobile");
                mobile.innerHTML =item.mobile;//改变内容

                var money = document.getElementById("money");
                money.innerHTML =item.money;//改变内容

                var address = document.getElementById("address");
                address.innerHTML =item.address;//改变内容
if (item.upopenid!=null&&item.upopenid!=""&&item.upopenid!=undefined){
    getUpuser(item.upopenid);
}
            }
        },'json'
    );
}

    function getUpuser(obj){
        mui.post('/User/findByid',
            {
                id:obj
            },
            function(data){
                console.log(data);
                if (data.code&&data.object!=null){
                    var  item=data.object;
                    var username = document.getElementById("username");
                    var upusername = document.getElementById("upusername");
                    upusername.innerHTML =item.username;//改变内容

                    var money = document.getElementById("jjrmoney");
                    money.innerHTML =item.money;//改变内容

                    var upmobile = document.getElementById("upmobile");
                    upmobile.innerHTML =item.mobile;//改变内容

                    var upaddress = document.getElementById("upaddress");
                    upaddress.innerHTML =item.address;//改变内容

                }
            },'json'
        );
    }
    $(function(){
        /*公共部分
         * 导航栏
         * footer CopyRight
         */
        getuser();
    $(".headage").load("head.html");
    $(".footerpage").load("footer.html");
    });
</script>
</html>